﻿using System;
using System.Drawing;
using System.Windows.Forms;
using Tzw.Common;

namespace Dafybjy
{
    public partial class ShowInfo : Form
    {
        private int _times = AppSettings.DlgTimes;
        public ShowInfo()
        {
            InitializeComponent();
        }

        public ShowInfo(Enums.ReportStatus status)
        {
            InitializeComponent();

            switch (status)
            {
                case Enums.ReportStatus.Error:
                    BackgroundImage = Image.FromFile("res\\imgs\\打印机故障，请通知工作人员！.jpg");
                    break;
                case Enums.ReportStatus.NoReport:
                    MusicPlay.PlayMusic($"{Environment.CurrentDirectory}\\res\\imgs\\没有您报告单.mp3");
                    BackgroundImage = Image.FromFile("res\\imgs\\没有您的报告单.jpg");
                    break;
                case Enums.ReportStatus.Printing:
                case Enums.ReportStatus.PrintingAndHasReport:
                    _times = 9999;
                    BackgroundImage = Image.FromFile("res\\imgs\\报告单打印中.jpg");
                    MusicPlay.PlayMusic(status == Enums.ReportStatus.Printing
                        ? $"{Environment.CurrentDirectory}\\res\\voice\\打印中无额外报告.mp3"
                        : $"{Environment.CurrentDirectory}\\res\\voice\\打印机有额外报告.mp3");
                    break;
                case Enums.ReportStatus.NoResult:
                    MusicPlay.PlayMusic($"{Environment.CurrentDirectory}\\res\\voice\\您的报告单正在检验中.mp3");
                    BackgroundImage = Image.FromFile("res\\voice\\结果未出.jpg");
                    break;
            }

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (_times-- < 1)
            {
                Close();
            }
        }
    }
}
